import yaml

#读取
def read_yaml(yaml_path):
    with open(yaml_path,encoding="utf-8") as f:
        value = yaml.safe_load(f)
        return value

#写入
def write_yaml(yaml_path):
    with open(yaml_path,encoding="utf-8",mode = "w") as f:
        data = {'data4': [{'data1': '鸡你太美'}, {'data1': '鸡你太美'}, {'data1': '鸡你太美'}]}
        yaml.safe_dump(data,f,allow_unicode=True)
#清空
def clean_yaml(yaml_path):
    with open(yaml_path,encoding="utf-8",mode = "w") as f:
        pass


if __name__ == '__main__':
     print(read_yaml("../test_api/test_api.yaml"))
    # write_yaml("../test_api/test_api.yaml")
     #clean_yaml("../test_api/test_api.yaml")

